package com.sc.nft.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum ImMethodEnum {

    CREATE_GROUP("v4/group_open_http_svc/create_group", "创建群组"),
    ADD_GROUP_MEMBER("v4/group_open_http_svc/add_group_member", "用户加入群组"),
    MODIFY_GROUP_MEMBER_INFO("v4/group_open_http_svc/modify_group_member_info", "修改组成员资料"),
    DELETE_GROUP_MEMBER("v4/group_open_http_svc/delete_group_member", "删除群成员"),
    DESTROY_GROUP("v4/group_open_http_svc/destroy_group", "解散群"),
    GET_JOINED_GROUP_LIST("v4/group_open_http_svc/get_joined_group_list", "获取用户所加入的群组"),
    SEND_GROUP_SYSTEM_NOTIFICATION("v4/group_open_http_svc/send_group_system_notification", "在群组中发送系统通知"),
    GET_GROUP_MUTED_ACCOUNT("v4/group_open_http_svc/get_group_muted_account", "获取被禁言群成员列表"),
    FORBID_SEND_MSG("v4/group_open_http_svc/forbid_send_msg", "批量禁言和取消禁言"),
    CHANGE_GROUP_OWNER("v4/group_open_http_svc/change_group_owner", "转让群主"),
    GET_GROUP_INFO("v4/group_open_http_svc/get_group_info", "获取群详细资料"),
    //    PORTRAIT_SET("v4/profile/portrait_set", "设置资料"),
    ACCOUNT_IMPORT("v4/im_open_login_svc/account_import", "导入单个帐号"),
    ACCOUNT_DELETE("v4/im_open_login_svc/account_delete", "删除帐号"),
    MODIFY_GROUP_BASE_INFO("v4/group_open_http_svc/modify_group_base_info", "修改群基础资料"),
    SEND_GROUP_MSG("v4/group_open_http_svc/send_group_msg", "在群组中发送普通消息"),
    GET_ROLE_IN_GROUP("v4/group_open_http_svc/get_role_in_group", "查询用户在群组中的身份"),
    BATCH_IMPORT_ACCOUNT("v4/im_open_login_svc/multiaccount_import", "导入多个帐号"),

    ;

    /**
     * 请求地址.
     */
    private String methodCode;

    /**
     * 业务描述
     */
    private String methodDesc;

    ImMethodEnum(String methodCode, String methodDesc) {
        this.methodCode = methodCode;
        this.methodDesc = methodDesc;
    }

    /**
     * 通过方法code获取枚举信息
     *
     * @param methodCode 方法code
     * @return
     * @date: 2021-03-10 10:11
     */
    public static ImMethodEnum get(String methodCode) {
        return Arrays.stream(ImMethodEnum.values()).filter(e -> e.getMethodCode().equals(methodCode)).findFirst().orElse(null);
    }
}
